<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
      layout:decorate="~{index}" xmlns:zy="http://zuoyy.com">
<head>
    <link rel="stylesheet" th:href="@{/css/generate.code.css}">
    <link rel="stylesheet" th:href="@{/lib/formSelects-v4/formSelects-v4.css}">
    <link rel="stylesheet" th:href="@{/plugins/zTree_v3/css/zTreeStyle/zTreeStyle.css}" type="text/css">
    <style>
        .timo-tree .ztree span.tree-add{
            margin-left:2px;
            background-position:-144px 0;
            vertical-align:top;
            *vertical-align:middle
        }

        /* 树形选择器 */

        .selectContent{
            display: none;
            position: absolute;
            z-index: 999;
            padding-bottom: 4px;
            overflow-y: scroll;
            max-height: 210px;
            background-color: #FAFAFA;
            border: 1px solid rgb(204, 204, 204);
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
        }
        .select-tree{
            cursor: pointer;
        }
        .select-tree + .layui-edge{
            position: absolute;
            right: 10px;
            top: 50%;
            margin-top: -3px;
            border-width: 6px;
            border-top: 6px solid #c2c2c2;
        }
    </style>
</head>
<body>

<div layout:fragment="main">
    <!-- RIBBON -->
    <div id="ribbon">
				<span class="ribbon-button-alignment">
					<span id="refresh" class="btn btn-ribbon" data-action="resetWidgets" data-title="refresh"
                          rel="tooltip" data-placement="bottom"
                          data-original-title="<i class='text-warning fa fa-warning'></i> Warning! This will reset all your widget settings."
                          data-html="true">
						<i class="fa fa-refresh"></i>
					</span>
				</span>
        <!-- breadcrumb -->
        <ol class="breadcrumb">
            <li>开发中心</li>
            <li>代码生成</li>
        </ol>
        <!-- end breadcrumb -->
    </div>
    <!-- END RIBBON -->


    <div id="content">
        <div class="row">
            <div class="col-sm-12">
                <div class="well">
                    <div class="layui-card-header timo-card-header">
                        <button class="layui-btn layui-btn-sm entity-save" th:attr="data-url=@{/dev/code/save}">
                            <i class="fa fa-floppy-o"></i>保存</button>
                    </div>
                    <fieldset id="basic" class="layui-elem-field layui-form">
                        <legend class="code-legend">基本信息</legend>
                        <div class="layui-field-box">
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label">项目包名</label>
                                    <div class="layui-input-inline">
                                        <input type="text" name="packagePath" th:value="${basic.packagePath}" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">模块名称</label>
                                    <div class="layui-input-inline">
                                        <input type="text" name="genModule" th:value="${basic.genModule}" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">业务名称</label>
                                    <div class="layui-input-inline">
                                        <input type="text" name="genTitle" autocomplete="off" class="layui-input">
                                    </div>
                                </div>

                            </div>
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label">表前缀</label>
                                    <div class="layui-input-inline">
                                        <input type="text" name="tablePrefix" th:value="${basic.tablePrefix}" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">表名称</label>
                                    <div class="layui-input-inline">
                                        <input type="text" name="tableName" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">实体类</label>
                                    <div class="layui-input-inline">
                                        <input type="text" name="tableEntity" autocomplete="off" class="layui-input tableEntity">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label">父级菜单</label>
                                    <div class="layui-input-inline">
                                        <input class="layui-input select-tree" th:attr="data-url=@{/system/menu/list}" type="text" name="genPMenu" value="顶级菜单" data-value="0" placeholder="请选择父级菜单">
                                    </div>
                                </div>
                            </div>
                            <div class="more-field">
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label">访问地址</label>
                                        <div class="layui-input-inline">
                                            <input type="text" name="requestMapping" autocomplete="off" class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">模块结构</label>
                                        <div class="layui-input-inline">
                                            <input type="radio" name="moduleType" value="1" title="独立模块" checked="">
                                            <input type="radio" name="moduleType" value="2" title="后台模块">
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <button class="layui-btn more-btn" title="更多按钮"><i class="fa fa-angle-down"></i></button>
                        </div>
                    </fieldset>
                    <div class="panel">
                        <div class="panel-header">
                            <div class="title">模板信息</div>
                            <div class="info"><i></i>创建<i class="lose"></i>忽略</div>
                            <div class="path">模块路径：<span class="bindPackagePath"></span>.xxx.<span class="bindGenModule"></span></div>
                        </div>
                        <div id="float" class="panel-body panel-body-float">
                            <div class="float-label active" data-name="entity">实体类：<span class="bindTableEntity"></span></div>
                            <div class="float-label active" data-name="controller">控制器：<span class="bindTableEntity"></span>Controller</div>
                            <div class="float-label active" data-name="service">服务层：<span class="bindTableEntity"></span>Service</div>
                            <div class="float-label active" data-name="query">条件查询类：<span class="bindTableEntity"></span>Query</div>
                            <div class="float-label active" data-name="repository">dao层：<span class="bindTableEntity"></span>Repository</div>
                            <div class="float-label active" data-name="index">列表页面：<span class="bindTableEntity"></span>/index.html</div>
                        </div>
                    </div>
                    <div class="panel">
                        <div class="panel-header">
                            <div class="title">实体类</div>
                            <div class="control">
                                <button class="field-add layui-btn layui-btn-primary layui-btn-xs">
                                    <i class="fa fa-plus-circle"></i>添加
                                </button>
                                <button class="field-del layui-btn layui-btn-primary layui-btn-xs">
                                    <i class="fa fa-minus-circle"></i>删除
                                </button>
                                <button class="field-up layui-btn layui-btn-primary layui-btn-xs">
                                    <i class="fa fa-arrow-up"></i>向上
                                </button>
                                <button class="field-down layui-btn layui-btn-primary layui-btn-xs">
                                    <i class="fa fa-arrow-down"></i>向下
                                </button>
                            </div>
                            <div class="entity"><span class="bindTableEntity"></span>(<span class="bindTablePrefix"></span><span class="bindTableName"></span>)</div>
                        </div>
                        <div class="panel-body panel-body-entity">
                            <table class="layui-table">
                                <thead>
                                <tr>
                                    <th width="20">#</th>
                                    <th width="100">字段名称</th>
                                    <th width="100">字段标题</th>
                                    <th width="100">数据类型</th>
                                </tr>
                                </thead>
                                <tbody id="entity">
                                <tr th:each="item,key:${fieldList}">
                                    <td class="entity-number" th:text="${key.index}+1"></td>
                                    <td class="entity-name"><input type="text" name="name" th:value="${item.name}"/></td>
                                    <td class="entity-title"><input type="text" name="title" th:value="${item.title}"/></td>
                                    <td class="layui-form entity-type">
                                        <select name="type" zy:list="${fieldType}" zy-selected="${item.type}" lay-verify="entity-type"></select>
                                    </td>
                                </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>

                </div>
            </div>
        </div>

    </div>


</div>

<script type="text/javascript" th:src="@{/plugins/zTree_v3/js/jquery.ztree.core.min.js}"></script>
<script type="text/javascript" th:src="@{/assets/js/myTree.js}"></script>

<script type="text/javascript">
    $(function () {
        // 树形菜单
        $('.select-tree').selectTree({
            rootTree: '顶级菜单'
        });


    });

    // 验证下拉选择器
    layui.config({
        base: '[[@{/lib/formSelects-v4/}]]'
    }).extend({
        formSelects: 'formSelects-v4.min'
    });
</script>

<script type="text/javascript" th:src="@{/js/generate.code.js}"></script>
</body>
</html>